package com.ebupt.service

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

@Database(entities = [AppUserInfo::class],version = 1,exportSchema = false)
abstract class UserDataBase: RoomDatabase() {

    abstract val useDao: UserDao

    companion object{
        private const val CNIAO_DB_NAME = "app_db"

        private var instance: UserDataBase?=null

        fun getInstance(context: Context): UserDataBase {

            return Room.databaseBuilder(context,
                UserDataBase::class.java,
                CNIAO_DB_NAME
            ).allowMainThreadQueries().build().also {
                instance = it
            }
        }


    }

}